<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>unpackUnorm - OpenGL ES 3.1 Reference Pages</title>
    <link rel="stylesheet" type="text/css" href="opengl-man.css"/>
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"/>
    <script type="text/x-mathjax-config">
            MathJax.Hub.Config({
                MathML: {
                    extensions: ["content-mathml.js"]
                },
                tex2jax: {
                    inlineMath: [['$','$'], ['\\(','\\)']]
                }
            });
        </script>
    <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"/>
  </head>
  <body>
    <header/>
    <div class="refentry" id="unpackUnorm">
      <div class="titlepage"/>
      <div class="refnamediv">
        <h2>Name</h2>
        <p>unpackUnorm2x16, unpackSnorm2x16, unpackUnorm4x8, unpackSnorm4x8 — unpack floating-point values from an unsigned integer</p>
      </div>
      <div class="refsynopsisdiv">
        <h2>Declaration</h2>
        <div class="funcsynopsis">
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">vec2 <strong class="fsfunc">unpackUnorm2x16</strong>(</code>
              </td>
              <td>uint <var class="pdparam">p</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">vec2 <strong class="fsfunc">unpackSnorm2x16</strong>(</code>
              </td>
              <td>uint <var class="pdparam">p</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">vec2 <strong class="fsfunc">unpackUnorm4x8</strong>(</code>
              </td>
              <td>uint <var class="pdparam">p</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">vec2 <strong class="fsfunc">unpackSnorm4x8</strong>(</code>
              </td>
              <td>uint <var class="pdparam">p</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
        </div>
      </div>
      <div class="refsect1" id="parameters">
        <h2>Parameters</h2>
        <div class="variablelist">
          <dl class="variablelist">
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>p</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>
                    Specifies an unsigned integer containing packed floating-point values.
                </p>
            </dd>
          </dl>
        </div>
      </div>
      <div class="refsect1" id="description">
        <h2>Description</h2>
        <p>
            <code class="function">unpackUnorm2x16</code>,
            <code class="function">unpackSnorm2x16</code>,
            <code class="function">unpackUnorm4x8</code>, and
            <code class="function">unpackSnorm4x8</code> unpack single 32-bit
            unsigned integers, specified in the parameter
            <em class="parameter"><code>p</code></em> into a pair of 16-bit unsigned
            integers. a pair of 16-bit signed integers, four 8-bit unsigned
            integers, or four 8-bit signed integers respectively. Then, each
            component is converted to a normalized floating-point value to
            generate the returned two- or four-component vector.
        </p>
        <p>
            The conversion for unpacked fixed point value <span class="emphasis"><em>f</em></span> to floating-point is performed as follows:
            </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>
                        <code class="function">unpackUnorm2x16</code>: <code class="code">f / 65535.0</code>
                    </p>
            </li>
            <li class="listitem">
              <p>
                        <code class="function">unpackSnorm2x16</code>: <code class="code">clamp(f / 32727.0, -1.0, 1.0)</code>
                    </p>
            </li>
            <li class="listitem">
              <p>
                        <code class="function">packUnorm4x8</code>: <code class="code">f / 255.0</code>
                    </p>
            </li>
            <li class="listitem">
              <p>
                        <code class="function">packSnorm4x8</code>: <code class="code">clamp(f / 127.0, -1.0, 1.0)</code>
                    </p>
            </li>
          </ul>
        </div>
        <p>
        </p>
        <p>
            The first component of the returned vector will be extracted from the least significant bits of the input;
            the last component will be extracted from the most significant bits.
        </p>
      </div>
      <div class="refsect1" id="versions">
        <h2>Version Support</h2>
        <div class="informaltable">
          <table style="border-collapse: collapse; border-top: 2px solid ; border-bottom: 2px solid ; border-left: 2px solid ; border-right: 2px solid ; ">
            <colgroup>
              <col style="text-align: left; "/>
              <col style="text-align: center; " class="firstvers"/>
              <col style="text-align: center; "/>
              <col style="text-align: center; " class="lastvers"/>
            </colgroup>
            <thead>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; ">
                 
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; " colspan="3">
                <span class="bold"><strong>OpenGL ES Shading Language Version</strong></span>
            </th>
              </tr>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>Function Name</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>1.00</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.00</strong></span>
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.10</strong></span>
            </th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">unpackUnorm2x16</td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">-</td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">unpackSnorm2x16</td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">-</td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">unpackSnorm4x8</td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">-</td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">-</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; ">unpackSnorm4x8</td>
                <td style="text-align: center; border-right: 2px solid ; ">-</td>
                <td style="text-align: center; border-right: 2px solid ; ">-</td>
                <td style="text-align: center; ">✔</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <div class="refsect1" id="seealso">
        <h2>See Also</h2>
        <p>
            <a class="citerefentry" href="clamp.xhtml"><span class="citerefentry"><span class="refentrytitle">clamp</span></span></a>,
            <a class="citerefentry" href="packUnorm2x16.xhtml"><span class="citerefentry"><span class="refentrytitle">packUnorm2x16</span></span></a>,
            <a class="citerefentry" href="packSnorm2x16.xhtml"><span class="citerefentry"><span class="refentrytitle">packSnorm2x16</span></span></a>
            <a class="citerefentry" href="packUnorm4x8.xhtml"><span class="citerefentry"><span class="refentrytitle">packUnorm4x8</span></span></a>
            <a class="citerefentry" href="packSnorm4x8.xhtml"><span class="citerefentry"><span class="refentrytitle">packSnorm4x8</span></span></a>
        </p>
      </div>
      <div class="refsect1" id="Copyright">
        <h2>Copyright</h2>
        <p>
            Copyright <span class="trademark"/>© 2011-2014 Khronos Group.
            This material may be distributed subject to the terms and conditions set forth in
            the Open Publication License, v 1.0, 8 June 1999.
            <a class="link" href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
        </p>
      </div>
    </div>
    <footer/>
  </body>
</html>
